package com.leonzhangxf.bucksdemo.order.api;

import com.leonzhangxf.bucksdemo.order.domain.OrderServiceImpl;
import io.micrometer.core.annotation.Timed;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class OrderApi {

    OrderServiceImpl orderService;

    @GetMapping("index")
    @Timed(
        value = "order.index", extraTags = {"site", "leonzhangxf-com"},
        description = "test for prometheus metrics"
    )
    public String index() {
        orderService.save();
        return "index";
    }

    @Autowired
    public void setOrderService(OrderServiceImpl orderService) {
        this.orderService = orderService;
    }
}
